<?php

if(!isset($_GET["id"]))
	die;

# get connection with mysql
$dblink = @mysql_connect("localhost","sm",""); $database = "sm";

if (!$dblink) {
    die('Could not connect: ' . mysql_error());
}
# select and open database
mysql_select_db($database,$dblink);

$DataArray = Array();

$result = mysql_query('SELECT `name`, `content` FROM `sm_files` WHERE `name`=\'' . mysql_escape_string ( $_GET["id"] ) .'\'');

if( mysql_num_rows( $result ) > 0 ) {

	$row = mysql_fetch_assoc( $result );
	
	echo json_encode( $row );	
	
} else
	echo "404";


?>